﻿using FluentValidation;
using FubuMVC.Core;
using NHibernate;

namespace complex.Controllers.Customers
{
    public class EditCustomerInputModelQuery
    {
        [RouteInput]
        public long Id { get; set; }
    }

    public class EditCustomerOutputModel
    {
        public long Id { get; set; }
        public string Name { get; set; }
        public string Line1 { get; set; }
        public string City { get; set; }
        public string State { get; set; }
        public string ZipCode { get; set; }
    }

    public class EditCustomerInputModelCommand
    {
        public long Id { get; set; }
        public string Name { get; set; }
        public string Line1 { get; set; }
        public string City { get; set; }
        public string State { get; set; }
        public string ZipCode { get; set; }
    }


    public class EditCustomerInputModelQueryValidator
        : AbstractValidator<EditCustomerInputModelQuery>
    {
        public EditCustomerInputModelQueryValidator(ISession session)
        {
            RuleFor(m => m.Id).NotEmpty();
        }
    }

    public class EditCustomerInputModelCommandValidator
        : AbstractValidator<EditCustomerInputModelCommand>
    {
        public EditCustomerInputModelCommandValidator()
        {
            RuleFor(m => m.Id).NotEmpty();
            RuleFor(m => m.Name).NotEmpty().Length(1, 50);
            RuleFor(m => m.Line1).NotEmpty().Length(1, 25);
            RuleFor(m => m.City).NotEmpty().Length(1, 30);
            RuleFor(m => m.State).NotEmpty().Length(2);
            RuleFor(m => m.ZipCode).NotEmpty().Length(5);
        }
    }
}